package com.isoftstone.disk.controller;

import com.isoftstone.disk.service.DiskService;
import com.isoftstone.platform.controller.BaseController;
import com.isoftstone.platform.entity.PadingRstType;
import com.isoftstone.platform.model.entity.FileEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/sto")
public class ShareController extends BaseController {

    @Resource
    private DiskService diskService;

    @RequestMapping("/page")
    public String showMyShare(){
        return "sto/page";
    }

    //查看分享
    @RequestMapping("/getSharedFileslist")
    @ResponseBody
    public PadingRstType<FileEntity> getSharedFileInfolist(){
        PadingRstType<FileEntity> padingRstType = diskService.getSharedFileslist();
        return padingRstType;
    }

    //取消分享
    @RequestMapping(value = "/cancelSharing/{fileId:.+}")
    @ResponseBody
    public void cancelSharing (@PathVariable("fileId") String fileId){
        diskService.cancelSharing(Integer.valueOf(fileId));

    }

}

